Marginal effectsとその周辺

多変量回帰・・・好きですか?

Nozomi Niimi

東京医療センター総合内科

2025-05-27

皆さん多変量回帰は好きですか?

  • 古くから研究されつくされており、信頼感がある

  • 多くの統計ソフトに入っており、行うのが簡単

  • 解釈性が高く、分かりやすい

  • 本当?

多変量回帰は簡単?

  • 多変量回帰は多くの種類がある
    • 0/1でLogistic回帰
    • 整数値だとPoisson回帰
    • 順序ロジット
    • Censored regression(Cox回帰もこのうち)
  • 選択肢が多く、その分どうすればよいのか分からない!

Many regression species

例えば・・・・・・

stressEcho Descriptives
stressEcho

31 Variables   558 Observations

bhr
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
5580690.99975.2974.516.57 54.0 58.0 64.0 74.0 84.0 95.3102.0
lowest : 42 44 45 46 47 , highest: 108 115 116 127 210
basebp
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
5580940.998135.3134.523.35104.0110.0120.0133.0150.0162.3170.1
lowest : 85 88 90 97 98 , highest: 192 194 195 201 203
basedp
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
5580441110181100162813 6607 7200 8400 9792116631361014770
lowest : 5000 5220 5280 5400 5460 , highest: 17604 17710 17748 21082 27300
pkhr
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
55801051120.612125.36 81.85 90.70106.25122.00135.00147.00155.15
lowest : 52 61 62 63 66 , highest: 170 171 176 182 210
sbp
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
55801421146.914540.72 96102120141170200210
lowest : 40 60 70 79 80 , highest: 240 250 274 283 309
dp
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
558050811763417339576510256113411403317060206442453626637
lowest : 5100 5940 7490 8100 8360 , highest: 32518 33400 33840 38205 45114
dose
image
nmissingdistinctInfoMeanpMedianGmd
558070.8433.75358.334
 Value         10    15    20    25    30    35    40
 Frequency      2    28    47    56    64    61   300
 Proportion 0.004 0.050 0.084 0.100 0.115 0.109 0.538 
For the frequency table, variable is rounded to the nearest 0
maxhr
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
55801031119.4119.524.64 82.0 91.0104.2120.0133.0146.0154.1
lowest : 58 62 63 66 67 , highest: 170 171 176 182 200
pctMphr
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
5580780.99978.5778.516.86 53 60 69 78 88 97104
lowest : 38 39 40 41 42 , highest: 116 117 126 132 133
mbp
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
55801320.99915615435.03110.0120.0133.2150.0175.8200.0211.1
lowest : 84 90 92 93 96 , highest: 240 250 274 283 309
dpmaxdo
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
558048411855018267538511346128651526018118212392489327477
lowest : 7130 8100 8360 9240 9280 , highest: 32518 33400 33840 38205 45114
dobdose
image
nmissingdistinctInfoMeanpMedianGmd
558080.94130.243010.55
 Value          5    10    15    20    25    30    35    40
 Frequency      7     7    55    73    71    78    62   205
 Proportion 0.013 0.013 0.099 0.131 0.127 0.140 0.111 0.367 
For the frequency table, variable is rounded to the nearest 0
age
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
5580620.99967.346813.4146.8551.0060.0069.0075.0082.0085.00
lowest : 26 28 29 30 33 , highest: 89 90 91 92 93
gender
nmissingdistinct
55802
 Value      female   male
 Frequency     338    220
 Proportion  0.606  0.394 

baseEF
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
5580540.99455.65710.7132405257626566
lowest : 20 21 22 23 25 , highest: 74 75 77 79 83
dobEF
image
nmissingdistinctInfoMeanpMedianGmd.05.10.25.50.75.90.95
5580600.99265.246712.3840.049.762.067.073.076.080.0
lowest : 23 25 26 27 28 , highest: 86 87 89 90 94
chestpain
nmissingdistinctInfoSumMean
558020.641720.3082

restwma
nmissingdistinctInfoSumMean
558020.7452570.4606

posSE
nmissingdistinctInfoSumMean
558020.5531360.2437

newMI
nmissingdistinctInfoSumMean
558020.143280.05018

newPTCA
nmissingdistinctInfoSumMean
558020.138270.04839

newCABG
nmissingdistinctInfoSumMean
558020.167330.05914

death
nmissingdistinctInfoSumMean
558020.123240.04301

hxofHT
nmissingdistinctInfoSumMean
558020.6253930.7043

hxofDM
nmissingdistinctInfoSumMean
558020.6992060.3692

hxofCig
image
nmissingdistinct
55803
 Value           heavy   moderate non-smoker
 Frequency         122        138        298
 Proportion      0.219      0.247      0.534 

hxofMI
nmissingdistinctInfoSumMean
558020.5991540.276

hxofPTCA
nmissingdistinctInfoSumMean
558020.204410.07348

hxofCABG
nmissingdistinctInfoSumMean
558020.399880.1577

any.event
nmissingdistinctInfoSumMean
558020.402890.1595

ecg
image
nmissingdistinct
55803
 Value      equivocal        MI    normal
 Frequency        176        71       311
 Proportion     0.315     0.127     0.557 

多変量回帰の複雑性~交互作用

  • 中の式も複雑になっている - 交互作用

Interactionの意味は?

  • Interaction項のORの解釈は?
    • 結果の一貫性を示す?
    • 結果の異質性を示す?

多変量回帰の複雑性~非線形

  • 非線形の関係の連続値の扱い方は?
    • LOESS? log? Rrestricted Cubic Spline?
  • RCSの解釈は?

Logistic Regression Model

lrm(formula = death_01 ~ rcs(age, 4) * rcs(crea1, 4) + sex + 
    meanbp1 + hrt1 + resp1 + alb1, data = rhc_prep)
Frequencies of Missing Values Due to Each Variable
death_01      age    crea1      sex  meanbp1     hrt1    resp1     alb1 
       0        0        0        0        0        0        0        2 
Model Likelihood
Ratio Test
Discrimination
Indexes
Rank Discrim.
Indexes
Obs 5733 LR χ2 425.17 R2 0.098 C 0.658
0 2013 d.f. 20 R220,5733 0.068 Dxy 0.317
1 3720 Pr(>χ2) <0.0001 R220,3918.6 0.098 γ 0.317
max |∂log L/∂β| 8×10-5 Brier 0.211 τa 0.144
β S.E. Wald Z Pr(>|Z|)
Intercept  -1.5123   1.1423 -1.32 0.1855
age   0.0354   0.0285 1.24 0.2141
age'   0.0223   0.0640 0.35 0.7272
age''  -0.0605   0.4179 -0.14 0.8848
crea1   0.6915   1.2167 0.57 0.5698
crea1'  -6.2577  22.2259 -0.28 0.7783
crea1''  10.0499  43.0148 0.23 0.8153
sex=Male   0.0882   0.0593 1.49 0.1366
meanbp1  -0.0043   0.0008 -5.57 <0.0001
hrt1   0.0016   0.0008 2.06 0.0399
resp1   0.0030   0.0021 1.42 0.1544
alb1  -0.1269   0.0426 -2.98 0.0029
age × crea1  -0.0077   0.0306 -0.25 0.8017
age' × crea1  -0.0256   0.0673 -0.38 0.7034
age'' × crea1   0.0802   0.4300 0.19 0.8521
age × crea1'   0.1578   0.5568 0.28 0.7769
age' × crea1'   0.3105   1.2149 0.26 0.7983
age'' × crea1'  -0.5983   7.6709 -0.08 0.9378
age × crea1''  -0.2886   1.0772 -0.27 0.7888
age' × crea1''  -0.5863   2.3490 -0.25 0.8029
age'' × crea1''   1.0391  14.8179 0.07 0.9441

例えば、2つの連続値をSplineで表したの場合~2

  • 本当のSplineでこんな感じ
  • どういう意味ですか?

我々はどこにいる?

治療効果は1つの結果で良いのか?

  • 集団全体の治療効果判定のみ
  • 患者のRiskによって治療効果は異なるはず
    • 治療効果の異質性


Call:  glm(formula = death_01 ~ swang1, family = binomial(link = "logit"), 
    data = rhc_prep)

Coefficients:
(Intercept)    swang1RHC  
     0.5309       0.2248  

Degrees of Freedom: 5734 Total (i.e. Null);  5733 Residual
Null Deviance:      7433 
Residual Deviance: 7418     AIC: 7422

ここまでの纏め

  • 多変量解析は解釈がわかりにくい!
    • 特に、InteractionやSplineが入るとよりわかりにくい
    • 通常の解析だと、結果は集団全体の平均で丸め込まれてしまう
      • Realな治療効果はBaselineのRiskでも変わるはず!
    • どうすればいい?

Marginal effectsという選択肢

  • G-computationについて

G-computation

  • 本来は、結果のStandardizationの手法
  • Estimandを決定する方法もある

G-computationの考え方

G-computationの応用~ATE/ATT/ATU

  • 元データのうち、元々Interventionが0/1の群だけで同様の事をするとATT/ATUも推定可能
  • Interventionだけでなくても、興味がある変数を動かす事で周辺効果(marginal effect)を出すことが可能
  • 重み付けを使うことで、Doubly robustも可能

G-computationの応用~Doubly robust

  1. Propensity score weightingを計算
  2. Outcomeを目標とする多変量回帰を作成
  3. 上記を組み合わせてDoubly robustを計算可能
  4. どの群を選ぶかでATT/ATE/ATUも簡単に計算可能!

G-computationの利点

  • 「この集団の介入を変えたら、どの程度良くなるか?」をダイレクトに伝えられる(King, Tomz, and Wittenberg 2000)
    • InteractionやSplineなど複雑な式でもシンプルに結果を伝えられる
  • 因果と予測を両方行う事が可能!

Average marginal prediction

通常のアウトカム式のみで一発勝負 ここはDoubly robustは使っちゃいけない

因果関係の場合

SUTVAの原理

そのため・・・・・・

例えば、Matching→G computation あるいは、元々のInclusionを入れて除外したあとにIPW→アウトカム式を入れる そうすることでDoubly robust estimationとなる

どういう式を作る?

基本は、ドメイン知識を入れる ただし、どのような関係性かをみるのにはAICとか、尤度比検定をしても良いかも

Box先生の名言

すべてのモデルは誤っている。しかし、そのうちのいくつかは役に立つ。

例えば

  • 大腸癌のデータセットLaurie et al. (1989)
Parameter Odds Ratio 95% CI p
(Intercept) 0.25 0.11, 0.56 < .001
rx [Lev] 0.92 0.66, 1.28 0.612
rx [Lev+5FU] 0.59 0.42, 0.83 0.003
age 1.01 1.00, 1.02 0.140
sex 1.03 0.78, 1.36 0.841
obstruct 1.41 1.00, 2.01 0.053
perfor 1.00 0.44, 2.29 0.997
adhere 1.65 1.11, 2.47 0.014
surg 1.47 1.07, 2.00 0.016
nodes 1.23 1.17, 1.30 < .001

結果の解釈

  1. Levamisoleの治療は経過観察と比べて有意差はなし
  2. Levamisole + 5-FUは経過観察に比べて予後良好と関連する

Good news!

(Hegyi et al. 2020)

  • NEJM, JAMA, Lancet, …を目指そう!
  • でも・・・
    • 例えば、副作用が30%増えるとして患者さんにどう説明する?
    • 他にも・・・

医学は無料ではない!

(Maurer et al. 2018)

  • 9716.5円/Cap x 4 x 365 = 1400万円/年

  • 医療経済的にどう考えればいい?

  • estimand -> 誰に?

  • どれくらい?

Marginal effects

  • 各群での、平均化(周辺化)した値をMarginal effectsという
    • 反対はConditional effectsという
  • 必要な群でのMarginal effectsこそが重要!!

RでのMarginal effectsの使い方

Thank you for your listening!!

References

Hegyi, Péter, Ole H. Petersen, Stephen Holgate, Bálint Erőss, András Garami, Zsolt Szakács, Dalma Dobszai, et al. 2020. “Academia Europaea Position Paper on Translational Medicine: The Cycle Model for Translating Scientific Results into Community Benefits.” Journal of Clinical Medicine 9 (5): 1532. https://doi.org/10.3390/jcm9051532.
King, Gary, Michael Tomz, and Jason Wittenberg. 2000. “Making the Most of Statistical Analyses: Improving Interpretation and Presentation.” American Journal of Political Science 44 (2): 347–61. https://doi.org/10.2307/2669316.
Laurie, J A, C G Moertel, T R Fleming, H S Wieand, J E Leigh, J Rubin, G W McCormack, J B Gerstner, J E Krook, and J Malliard. 1989. “Surgical Adjuvant Therapy of Large-Bowel Carcinoma: An Evaluation of Levamisole and the Combination of Levamisole and Fluorouracil. The North Central Cancer Treatment Group and the Mayo Clinic.” Journal of Clinical Oncology 7 (10): 1447–56. https://doi.org/10.1200/jco.1989.7.10.1447.
Maurer, Mathew S, Jeffrey H Schwartz, Balarama Gundapaneni, Perry M Elliott, Giampaolo Merlini, Marcia Waddington-Cruz, Arnt V Kristen, et al. 2018. “Tafamidis Treatment for Patients with Transthyretin Amyloid Cardiomyopathy.” The New England Journal of Medicine 379 (11): 1007–16. https://doi.org/10.1056/NEJMoa1805689.
Therneau, Terry M. 2024. A Package for Survival Analysis in r. https://CRAN.R-project.org/package=survival.